package com.xiaoxi.xioj.judge.codesandbox;

import com.xiaoxi.xioj.judge.codesandbox.impl.ExampleCodeSandbox;
import com.xiaoxi.xioj.judge.codesandbox.impl.RemoteCodeSandbox;
import com.xiaoxi.xioj.judge.codesandbox.impl.ThirdPartyCodeSandbox;
import org.springframework.beans.factory.annotation.Value;

/**
 *  代码沙箱工厂类
 */
public class CodeSandboxFactory {

//    @Value("${codesandbox.type:example}")
//    private String type;

    public static CodeSandbox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
